import 'dart:convert';

import 'package:flutter/services.dart';

/// <summary>
/// author：zwb
/// dateTime： 2021/12/11 16:49
/// filePath： lib/page/rong_im/rong_constant.dart
/// desc: 融云im 常量类
/// <summary>
///
class RongConstant {
  /// 本地图片路径
  static String imagesPath = "assets/image/";

  /// 本地json路径
  static String jsonPath = "assets/json/";

  ///  读取本地json文件
  /// [jsonName] json名称
  static Future<Map<String, dynamic>> getLocalJson(String jsonName) async {
    Map<String, dynamic> map =
        jsonDecode(await rootBundle.loadString(jsonPath + jsonName));
    return map;
  }

  ///  读取本地图片文件
  /// [imgName] 图片名称
  static String getLocalImg(String imgName) => imagesPath + imgName;

  ///  读取本地文件
  /// [pathFileName] 完整路径
  static Future<Map<String, dynamic>> getLocalFile(String pathFileName) async {
    Map<String, dynamic> map =
        jsonDecode(await rootBundle.loadString(pathFileName));
    return map;
  }
}
